<?php 
class ControllerCommonHeader extends Controller {
	protected function index() {
		$this->data['title'] = $this->document->getTitle(); 
		
		if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
			$this->data['base'] = HTTPS_SERVER;
		} else {
			$this->data['base'] = HTTP_SERVER;
		}
		
		$this->data['description'] = $this->document->getDescription();
		$this->data['keywords'] = $this->document->getKeywords();
		$this->data['links'] = $this->document->getLinks();	
		$this->data['styles'] = $this->document->getStyles();
		$this->data['scripts'] = $this->document->getScripts();
        
        $this->data['heading_title'] = '';
        $this->data['text_confirm'] = '删除/卸载动作将不能被恢复，确认执行吗';
        $this->data['text_user'] = '用户';
        $this->data['text_usermanger'] = '用户管理';
        $this->data['text_dashboard'] = '控制面板';
        $this->data['text_setting'] = '设置';
        $this->data['text_design'] = '界面';
        $this->data['text_banner'] = 'Banner管理';
        $this->data['text_article'] = '文章';
        $this->data['text_error_log'] = '错误日志';
        $this->data['text_article_list'] = '文章管理';
        $this->data['text_article_category'] = '目录管理';
        $this->data['text_front'] = '网站';
		$this->data['text_help'] = '帮助';
        $this->data['text_logout'] = '退出';
        $this->data['text_system'] = '系统';
        
		
		if ( !$this->user->isLogged()  || !isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token'])) {
			$this->data['logged'] = '';
			
			$this->data['home'] = $this->url->link('common/login', '', 'SSL');
		} else {			
			
            $this->data['logged'] = sprintf('%s 已登录', $this->user->getUserName());

			$this->data['home'] = $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['store'] = HTTP_CATALOG;
			$this->data['backup'] = $this->url->link('tool/backup', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['error_log'] = $this->url->link('tool/error_log', 'token=' . $this->session->data['token'], 'SSL');
            $this->data['setting'] = $this->url->link('tool/setting', 'token=' . $this->session->data['token'], 'SSL');
            $this->data['banner'] = $this->url->link('design/banner', 'token=' . $this->session->data['token'], 'SSL');
            $this->data['user'] = $this->url->link('user/user', 'token=' . $this->session->data['token'], 'SSL');
            $this->data['article'] = $this->url->link('article/article', 'token=' . $this->session->data['token'], 'SSL');
            $this->data['article_category'] = $this->url->link('article/category', 'token=' . $this->session->data['token'], 'SSL');
            $this->data['user'] = $this->url->link('user/user', 'token=' . $this->session->data['token'], 'SSL');
            $this->data['logout'] = $this->url->link('common/logout', 'token=' . $this->session->data['token'], 'SSL');
		}
		
		$this->template = 'common/header.tpl';
		
		$this->render();
	}
}
?>